<%@ page language="java" import="java.util.*,
entitybean.oc_date_ice.EnitityBeanOc_Date_Ice,
entitybean.oc_boat_ice.EntityBeanOc_Boat_Ice,
entitybean.oc_depthlist_ice.EntityBeanOc_Depthlist_Ice,
entitybean.oc_property_ice.EntityBean_Oc_Property_Ice,
entitybean.oc_voyage_ice.EnitityBeanOc_Voyage_Ice,
entitybean.oc_station_ice.EntityBeanOc_Station_Ice,
entitybean.oc_property_tools_ice.EntityBean_Oc_Property_Tools_Ice;
" pageEncoding="utf-8"%>
<%
Integer boat_id=(Integer)request.getAttribute("boat_id");
List<EnitityBeanOc_Voyage_Ice> voyage_list=(List<EnitityBeanOc_Voyage_Ice>)request.getAttribute("voyage_list");
List<EntityBeanOc_Station_Ice> station_list=(List<EntityBeanOc_Station_Ice>)request.getAttribute("station_list");
List<EntityBean_Oc_Property_Tools_Ice> property_tool_list=(List<EntityBean_Oc_Property_Tools_Ice>)request.getAttribute("property_tool_list");
List<EntityBeanOc_Boat_Ice>boat_list=(List<EntityBeanOc_Boat_Ice>)request.getAttribute("boat_list");
List<EntityBean_Oc_Property_Ice>property_list=(List<EntityBean_Oc_Property_Ice>)request.getAttribute("property_list");
List<EntityBeanOc_Depthlist_Ice>depthlist= (List<EntityBeanOc_Depthlist_Ice>)request.getAttribute("depthlist");
EnitityBeanOc_Date_Ice e=(EnitityBeanOc_Date_Ice)request.getAttribute("e"); 
 %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>adminindex</title>
<link href="../../css/style.css" rel="stylesheet" type="text/css" />
<style>
body{
	background-color: #EAEBE3;
}
</style>
<script type="text/javascript" src="dwr/engine.js">
</script>
		<script type="text/javascript" src="dwr/util.js">
</script>
		<script type="text/javascript" src="dwr/interface/voyage.js">
</script>
<script language="javascript">

function load_voyage()
{
	var id = document.getElementById("oc_boat_id").value;
	//window.alert(id);
	if (id != -1) {

		voyage.Ajax_voyage_load_ice(id, checkerA);
	} else {
		for (k = document.getElementById("oc_voyage_id").children.length - 1; k >= 0; k--) {
			//remove all
			document.getElementById("oc_voyage_id").removeChild(
					document.getElementById("oc_voyage_id").children(0));
		}
		var varItem = new Option("请选择", -1);
		document.getElementById("oc_voyage_id").add(varItem);
	}
	}
function load_property_tools()
{
	var id = document.getElementById("oc_property_id").value;
	//window.alert(id);
	if (id != -1) {

		voyage.Ajax_tools_load_ice(id, checkerC);
	} else {
		for (k = document.getElementById("oc_property_tools_id").children.length - 1; k >= 0; k--) {
			//remove all
			document.getElementById("oc_property_tools_id").removeChild(
					document.getElementById("oc_property_tools_id").children(0));
		}
		var varItem = new Option("请选择", -1);
		document.getElementById("oc_property_tools_id").add(varItem);
	}
	
	
	
	}
function load_station()
{
		var id = document.getElementById("oc_voyage_id").value;
	//window.alert(id);
	if (id != -1) {

		voyage.Ajax_station_load_ice(id, checkerB);
	} else {
		for (k = document.getElementById("oc_station_id").children.length - 1; k >= 0; k--) {
			//remove all
			document.getElementById("oc_station_id").removeChild(
					document.getElementById("oc_station_id").children(0));
		}
		var varItem = new Option("请选择", -1);
		document.getElementById("oc_station_id").add(varItem);
	}
	}
function checkerA(str) {
	for (k = document.getElementById("oc_voyage_id").children.length - 1; k >= 0; k--) {
		//remove all
		document.getElementById("oc_voyage_id").removeChild(
				document.getElementById

				("oc_voyage_id").children(0));
	}
	var varItem = new Option("请选择", -1);
	document.getElementById("oc_voyage_id").add(varItem);
	strword = str;
	while (strword.indexOf(",") > 0) {
		var key = cut_word(strword, ",");
		var val = cut_word(strword, ",");
		var varItem = new Option(val, key);
		document.getElementById("oc_voyage_id").add(varItem);
	}
}
function checkerB(str) {
	for (k = document.getElementById("oc_station_id").children.length - 1; k >= 0; k--) {
		//remove all
		document.getElementById("oc_station_id").removeChild(
				document.getElementById

				("oc_station_id").children(0));
	}
	var varItem = new Option("请选择", -1);
	document.getElementById("oc_station_id").add(varItem);
	strword = str;
	while (strword.indexOf(",") > 0) {
		var key = cut_word(strword, ",");
		var val = cut_word(strword, ",");
		var varItem = new Option(val, key);
		document.getElementById("oc_station_id").add(varItem);
	}
}
function checkerC(str) {
	for (k = document.getElementById("oc_property_tools_id").children.length - 1; k >= 0; k--) {
		//remove all
		document.getElementById("oc_property_tools_id").removeChild(
				document.getElementById

				("oc_property_tools_id").children(0));
	}
	var varItem = new Option("请选择", -1);
	document.getElementById("oc_property_tools_id").add(varItem);
	strword = str;
	while (strword.indexOf(",") > 0) {
		var key = cut_word(strword, ",");
		var val = cut_word(strword, ",");
		var varItem = new Option(val, key);
		document.getElementById("oc_property_tools_id").add(varItem);
	}
}


function cut_word(str, keyword) {
	var i = str.indexOf(keyword);
	var backword = str.substring(0, i);
	strword = str.substring(i + 1);
	return backword
}
function  update_me()
{
   	var oc_boat_id=document.getElementById("oc_boat_id").value;
   	var oc_voyage_id=document.getElementById("oc_voyage_id").value;
   	var oc_station_id=document.getElementById("oc_station_id").value;
   	var oc_deplist_id=document.getElementById("oc_deplist_id").value;
   	var oc_property_id=document.getElementById("oc_property_id").value;
   	var oc_property_tools_id=document.getElementById("oc_property_tools_id").value;
   	var value_key=document.getElementById("value_key").value;
	if(oc_boat_id=="")
	{
		window.alert("科考船不得为空!");
		return false;
	}
	if(oc_voyage_id=="")
	{
		window.alert("航次不得为空!");
		return false;
	}
	if(oc_station_id=="")
	{
		window.alert("站点不得为空!");
		return false;
	}
	if(oc_deplist_id=="")
	{
		window.alert("层深不得为空!");
		return false;
	}
	if(oc_property_id=="")
	{
		window.alert("属性不得为空!");
		return false;
	}
	if(oc_property_tools_id=="")
	{
		window.alert("属性工具不得为空!");
		return false;
	}
	if(value_key=="")
	{
		window.alert("值不得为空!");
		return false;
	}
		
		var url="<%=request.getContextPath()%>/admin_init_oc_data_ice.do?method=admin_update_oc_data_ice&v="+Math.random();
		document.getElementById("form1").action=url;
    	document.getElementById("form1").submit();
}
</script>
</head>
<body>


<div class="admin_nei">


<div class="xge">
  <!--<div class="xgetitle"><img src="../../images/admin_38.jpg" alt="" /></div> -->
  <div class="gt">
    
    
    
    <div class="gtt">
   <table width="100%" border="0" cellpadding="0" cellspacing="1" bgcolor="#a0a297">
     <tr>
       <td bgcolor="#eaebe3">数据添加</td>
       </tr>
   </table>
       <form id="form1" name="form1" method="post" action="">
   <table width="100%" border="0" cellpadding="5" cellspacing="1" bgcolor="#E6E6E6" id="admintxt">
     <tr>
       <td width="14%" align="right" bgcolor="#FFFFFF">科考船：</td>
       <td width="86%" bgcolor="#FFFFFF"><select name="oc_boat_id" id="oc_boat_id" onchange="load_voyage()">
         <option value="">请选择</option>
         <%for(int i=0;i<boat_list.size();i++)
         { %>
         <option value="<%=boat_list.get(i).getId()%>" <%if(boat_id.equals(boat_list.get(i).getId())){ %> selected <%} %>><%=boat_list.get(i).getOc_boatname()%></option>
         <%
         } 
         %>
       </select></td>
       </tr>
     <tr>
       <td align="right" bgcolor="#FFFFFF">航次：</td>
       <td bgcolor="#FFFFFF">
       <select name="oc_voyage_id" id="oc_voyage_id" onchange="load_station()">
       <option value="">请选择</option>
        <%for(int i=0;i<voyage_list.size();i++)
         { %>
         <option value="<%=voyage_list.get(i).getId()%>" <%if(e.getOc_voyage_id().equals(voyage_list.get(i).getId())){ %> selected <%} %>><%=voyage_list.get(i).getVoyage_name()%></option>
         <%
         } 
         %>
       </select></td>
     </tr>
     <tr>
       <td align="right" bgcolor="#FFFFFF">站点：</td>
       <td bgcolor="#FFFFFF">
       <select name="oc_station_id" id="oc_station_id">
       <option value="">请选择</option>
        <%for(int i=0;i<station_list.size();i++)
         { %>
         <option value="<%=station_list.get(i).getId()%>" <%if(e.getOc_station_id().equals(station_list.get(i).getId())){ %> selected <%} %>><%=station_list.get(i).getStation_name()%></option>
         <%
         } 
         %>
       </select></td>
     </tr>
     <tr>
       <td align="right" bgcolor="#FFFFFF">深度</td>
       <td bgcolor="#FFFFFF"><select name="oc_deplist_id" id="oc_deplist_id">
         <option value="">请选择</option>
         <%for(int i=0;i<depthlist.size();i++)
         { %>
         <option value="<%=depthlist.get(i).getId()%>" <%if(e.getOc_deplist_id().equals(depthlist.get(i).getId())){ %> selected <%} %>><%=depthlist.get(i).getDepth()%></option>
         <%
         } 
         %>
       </select></td>
     </tr>
     <tr>
       <td align="right" bgcolor="#FFFFFF">属性：</td>
       <td bgcolor="#FFFFFF">
       <select name="oc_property_id" id="oc_property_id" onchange="load_property_tools()">
       <option value="">请选择</option>
        <%for(int i=0;i<property_list.size();i++)
         { %>
         <option value="<%=property_list.get(i).getId()%>" <%if(e.getOc_property_id().equals(property_list.get(i).getId())){ %> selected <%} %>><%=property_list.get(i).getProperty_name()%></option>
         <%
         } 
         %>
       
       
       </select></td>
     </tr>
     <tr>
       <td align="right" bgcolor="#FFFFFF">属性工具：</td>
       <td bgcolor="#FFFFFF">
       <select name="oc_property_tools_id" id="oc_property_tools_id">
       <option value="">请选择</option>
        <%for(int i=0;i<property_tool_list.size();i++)
         { %>
         <option value="<%=property_tool_list.get(i).getId()%>" <%if(e.getOc_property_tools_id().equals(property_tool_list.get(i).getId())){ %> selected <%} %>><%=property_tool_list.get(i).getTools_name()%></option>
         <%
         } 
         %>
       </select></td>
     </tr>
     <tr>
       <td align="right" bgcolor="#FFFFFF">值：</td>
       <td bgcolor="#FFFFFF"><input type="text" name="value_key" id="value_key" value="<%=e.getValue_key()%>" /></td>
     </tr>
     <tr>
       <td bgcolor="#FFFFFF">&nbsp;</td>
       <td bgcolor="#FFFFFF"><input  type="hidden" name="id" id="id" value="<%=e.getId()%>"/><input type="button" name="button" id="button" onclick="update_me()" value=" 提交 " /></td>
      
     </tr>
   </table>
   </form>
 </div>
    
    
    
    
    </div>
  
</div>
</div>







</body>
</html>
